import csv
import os.path
import logging

log = logging.getLogger(__name__)
mturk_data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data/mturk')
surveys = {}

def list_files():
    """Lists available filenames"""
    return [f for f in os.listdir(mturk_data_dir)]

def load_surveys(data_file):
    """Load survey questions"""
    queries = []
    reader = csv.reader(open(_getfile(data_file),'r'))
    for line in reader:
        queries.append(line[-1])
    surveys[data_file] = queries

def _getfile(fname):
    """Utility to get full path of mturk file"""
    return os.path.join(mturk_data_dir, fname)




